//
//  OFileManager.m
//  OFootball
//
//  Created by 上官千城 on 15/9/22.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import "OFileManager.h"

@implementation OFileManager

+(NSString*)getDocumentPath
{
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];

    return documentPath;
}

+(BOOL)createDirInDocument:(NSString *)dirName
{
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *documentPath = [OFileManager getDocumentPath];
    NSString *path = [documentPath stringByAppendingPathComponent:dirName];
    
    BOOL result =  [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
    
    return result;
}

+(BOOL) isDirExistInDocument:(NSString *)dirName
{
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *documentPath = [OFileManager getDocumentPath];
    NSString *path = [documentPath stringByAppendingPathComponent:dirName];
    
    BOOL isDirectory;
    
    BOOL result = [fileManager fileExistsAtPath:path isDirectory:&isDirectory];
    
    if (!isDirectory) {
        result = NO;
    }
    return result;
}

+(BOOL) deleteFileInDocument:(NSString*)fileName
{
    //TODO:需要实现
    return YES;
}

+(BOOL) deleteFile:(NSString*)fileName
{
    //TODO:需要实现
    return YES;
}

@end
